package com.paipaideli.ui.product;

/**
 * Created by Administrator on 2019/9/29.
 */

public class ProductDetailTranslate {


    String wrapperHtml(String task) {
        return insertHtmlTag(task);
    }

    String insertHtmlTag(String task)
    {
        StringBuilder builder = new StringBuilder();
        builder.append("<!DOCTYPE html>\n");
        builder.append("<html lang=\"zh-cn\">\n");
        builder.append(getHeader());
        builder.append(insertBodyTag(task));
        builder.append("</html>");
        return builder.toString();
    }

    String insertBodyTag(String task) {
        StringBuilder builder = new StringBuilder();
        builder.append("<body style=\"margin: 0; padding: 0;word-wrap:break-word;window.PointerEvent = undefined;\"> \n");
        builder.append(task);
        builder.append("</body>\n");
        return builder.toString();
    }


    String getHeader() {
        StringBuilder builder = new StringBuilder();
        String css = "img { border:none; width:100%; height:auto;margin:0px;padding:0px;display:block;}body {margin:0; padding:0;}div,p,span { white-space:pre-wrap;}";
        builder.append("<head>\n");
        builder.append("<meta charset=\"utf-8\">\n");
        builder.append("<meta name=\"format-detection\" content=\"telephone=no\">\n");
        builder.append("<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">\n");
        builder.append("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\">\n");
        builder.append("<style>\n");
        builder.append(css + "\n");
        builder.append("</style>\n");
        builder.append("<meta id=\"viewport\" name=\"viewport\" content=\"width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0\">\n");
        builder.append("<title> </title>\n");
        builder.append("</head>\n");
        return builder.toString();
    }



}
